SuperPool Lens
Overview
The SuperPoolLens is a helper contract with view-only functions that help fetch SuperPool metrics, BasePool metrics, and data for assets deposited by users in the SuperPool.
State Variables
POOL
Address to the protocol's pool instance
Pool public immutable POOL;
RISK_ENGINE
Address to the protocol's risk engine instance
RiskEngine public immutable RISK_ENGINE;
Functions
constructor
constructor(address pool, address riskEngine);
Parameters
| Name | Type | Description | 
|---|---|---|
| pool | address | Address to the protocol's pool instance | 
| riskEngine | address | Address to the protocol's risk engine instance | 
getSuperPoolData
Fetch current state for a given SuperPool
function getSuperPoolData(address _superPool) external view returns (SuperPoolData memory superPoolData);
Parameters
| Name | Type | Description | 
|---|---|---|
| _superPool | address | Address of the super pool | 
Returns
| Name | Type | Description | 
|---|---|---|
| superPoolData | SuperPoolData | Comprehensive current state data for the given super pool | 
getPoolDepositData
Fetch data for SuperPool deposits in a given pool
function getPoolDepositData(
    address superPool,
    uint256 poolId
) public view returns (PoolDepositData memory poolDepositData);
Parameters
| Name | Type | Description | 
|---|---|---|
| superPool | address | Address of the super pool | 
| poolId | uint256 | Id for the underlying pool | 
Returns
| Name | Type | Description | 
|---|---|---|
| poolDepositData | PoolDepositData | Current data for deposits to poolIdfrom thesuperPool | 
getUserMultiDepositData
Fetch the current data for a given user's deposits across multiple super pools
function getUserMultiDepositData(
    address user,
    address[] calldata superPools
) public view returns (UserMultiDepositData memory userMultiDepositData);
Parameters
| Name | Type | Description | 
|---|---|---|
| user | address | Address of the user | 
| superPools | address[] | List of SuperPool addresses to fetch data | 
Returns
| Name | Type | Description | 
|---|---|---|
| userMultiDepositData | UserMultiDepositData | Current deposit data for useracross each super pool | 
getUserDepositData
Fetch a particular user's deposit data for a given super pool
function getUserDepositData(
    address user,
    address _superPool
) public view returns (UserDepositData memory userDepositData);
Parameters
| Name | Type | Description | 
|---|---|---|
| user | address | Address of the user | 
| _superPool | address | Address of the superPool | 
Returns
| Name | Type | Description | 
|---|---|---|
| userDepositData | UserDepositData | Current user deposit data for the given super pool | 
getPoolInterestRate
Fetch current borrow interest rate for a given pool
function getPoolInterestRate(uint256 poolId) public view returns (uint256 interestRate);
Parameters
| Name | Type | Description | 
|---|---|---|
| poolId | uint256 | Id of the underlying pool | 
Returns
| Name | Type | Description | 
|---|---|---|
| interestRate | uint256 | current interest rate for the given pool | 
getSuperPoolInterestRate
Fetch the weighted interest yield for a given super pool
function getSuperPoolInterestRate(address _superPool) public view returns (uint256 interestRate);
Parameters
| Name | Type | Description | 
|---|---|---|
| _superPool | address | Address of the super pool | 
Returns
| Name | Type | Description | 
|---|---|---|
| interestRate | uint256 | current weighted interest yield for the given super pool | 
Structs
SuperPoolData
Comprehensive data container for SuperPool state including individual pool deposits and aggregate data
struct SuperPoolData {
    string name;
    address asset;
    uint256 idleAssets;
    uint256 totalAssets;
    uint256 valueInEth;
    uint256 interestRate;
    PoolDepositData[] deposits;
}
PoolDepositData
Generic data container for SuperPool deposits associated with a particular pool
struct PoolDepositData {
    address asset;
    uint256 poolId;
    uint256 amount;
    uint256 valueInEth;
    uint256 interestRate;
}
UserMultiDepositData
Container for a user's deposits across multiple super pools
struct UserMultiDepositData {
    address owner;
    uint256 interestRate;
    uint256 totalValueInEth;
    UserDepositData[] deposits;
}
UserDepositData
Container for a user's deposit in a single SuperPool
struct UserDepositData {
    address owner;
    address asset;
    address superPool;
    uint256 amount;
    uint256 valueInEth;
    uint256 interestRate;
}